/**
 * 滑动窗口
 * @param {*} target 
 * @param {*} nums 
 * @returns 
 */
var minSubArrayLen = function(target, nums) {
    const n = nums.length
    let l=0,
        count=0,
        subLength=0,
        res=Infinity
    for(let i=0;i<nums.length;i++){
        count+=nums[i]
        while(count>=target){
          subLength=i-l+1
          res=res>subLength? subLength:res
          count-=nums[l++]
        }
    }
    return res==Infinity? 0 : res
};
/***
 * 精髓部分只要 子序列 大于等于target  就让起始位置滑动
 */
// while(count>=target){
//     subLength=i-l+1
//     res=res>subLength? subLength:res
//     count-=nums[l++]
//   }
